<%--
  Created by IntelliJ IDEA.
  User: Hasee
  Date: 2020/8/20
  Time: 16:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    <title>老师登录</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script src="${ctx}/webjars/jquery/3.3.1-2/jquery.min.js"></script>
    <script type="text/javascript">
        $(function(){
            $("login").click(function(){
                $.ajax({
                    url:"tc/login",
                    data:{"tname":$("#loginname").val(),"tpwd":$("#loginpwd").val()},
                    type:"post",
                    dataType:"text",
                    success:function (data) {
                        if(data.flag){
                            location.href="";
                        }else{
                            $("h3").html("账号或密码错误");
                        }
                    }
                })
            })
        })

    </script>
</head>
<body>
    <form action="" method="post">
        账号：<input id="loginname" type="text" value="zhangsan"><h3 style="color: red"></h3><br>
        密码：<input id="loginpwd" type="password" value="123"><br>
        <input id="login" type="submit" value="提交">
    </form>
</body>
</html>
